import React, { useEffect, useState } from 'react'
import '../css/Hwj_index.css'
import { Toast, NavBar, Tag, Divider, Cell } from 'react-vant';
import { createFromIconfontCN } from '@react-vant/icons'
import { useNavigate } from 'react-router-dom';
import { get } from '../../../axios/request'
const IconFont = createFromIconfontCN(
    '//at.alicdn.com/t/c/font_4695075_pl7cx9w2bje.js'
)
export default function Hwj_other() {
    let navigate = useNavigate()
    let [orders, setOrders] = useState(
        [
            { _id: '1', times: '6月24日 10:00', start_add: '鲲玺园', end_add: '保理' },
            { _id: '2', times: '6月24日 10:00', start_add: '鲲玺园', end_add: '保理' },
        ]
    )
    let [journey, setJourney] = useState([])
    let getjourney = async () => {
        let res = await get('/hwj/getjourney', { userid: '67073b3a316728bcfadbc349' })
        console.log(res);
        if (res.code === 200) {
            setJourney(res.data)
            console.log(journey);
        }

    }
    useEffect(() => {
        getjourney()
    }, [])
    return (
        <div id='other_ordersbox'>
            <NavBar
                title="选择售后订单"
                // leftText=""
                // rightText="按钮"
                onClickLeft={() => { navigate(-1) }}
                onClickRight={() => Toast('按钮')}

            />
            <div className="conbox">
                {
                    journey.map(item => (
                        <Cell
                            onClick={() => { navigate('/hwj_service',{state:{id:item._id}}) }}
                            key={item._id}
                            title={
                                <div className='con_2'>
                                    <p>约车 {item.times}</p>
                                    <Tag color="rgb(227, 227, 227)" textColor="grey">已完成</Tag>
                                </div>
                            }
                            isLink
                            label={
                                <div className="con_1">
                                    <div>
                                        <IconFont name='icon-yuandian' fontSize={25} />
                                        <span>{item.start}</span>
                                    </div>
                                    <div>
                                        <IconFont name='icon-yuandian-green' fontSize={25} />
                                        <span>{item.end}</span>
                                    </div>
                                </div>
                            }
                            size='large'
                        />
                    ))
                }
            </div>
        </div>
    )
}
